﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="<?php echo $_BASE_DIR?>css_v1/style.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo $_BASE_DIR?>css_v1/select.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo $_BASE_DIR?>css_v1/jquery.datetimepicker.css" rel="stylesheet" type="text/css" />
    <!-- tips -->
    <link type="text/css" href="<?php echo $_BASE_DIR?>jqmobile/jquery.ui.tooltip.css" rel="stylesheet">
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>jqmobile/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>jqmobile/jquery.ui.widget.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>jqmobile/jquery.ui.position.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>jqmobile/jquery.ui.tooltip.js"></script>
    <!--<script type="text/javascript" src="<?php /*echo $_BASE_DIR*/?>js_v1/jquery.js"></script>-->
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>js_v1/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>js_v1/select-ui.min.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>javascripts/commond.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>baidu_editor/ueditor.config.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>js_v1/jquery.datetimepicker.js"></script>
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>js_v1/jquery.DatePicker.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="<?php echo $_BASE_DIR?>baidu_editor/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="<?php echo $_BASE_DIR?>baidu_editor/lang/zh-cn/zh-cn.js"></script>
    <link href="<?php echo $_BASE_DIR?>uploadify/css/uploadify.css" rel="stylesheet" type="text/css" />

    <style type="text/css">
        #header {
            height: 85px
        }

        #leftside,#container,#splitBar,#splitBarProxy {
            top: 90px
        }
    </style>

    <script type="text/javascript">
        $(document).ready(function(e) {
            $(".select1").uedSelect({
                width : 102
            });
            $(".select2").uedSelect({
                width : 167
            });
            $(".select3").uedSelect({
                width : 100
            });
            //启动tip功能
            $( document ).tooltip({
                position: { my: "left+15 center", at: "right center" }
            });
        });
    </script>

    <script src="<?php echo $_BASE_DIR?>javascripts/jquery.ocupload.min.js"
            type="text/javascript"></script>

    <script type="text/javascript">
        function ajaxpost(form)
        {
            var reg=/^(file|http|https|ftp|mms|telnet|news|wais|mailto):\/\/(.*)$/;
            var data = $(form).serialize();
            var name = $(form).attr("name");
            var tip = "";
            var tips=1;
            $("#"+name+" li").each(function(){
                var _this = $(this);
                var input = _this.find("input");
                if(input.hasClass("url") && input.val() !== ""){
                    var url=input.val();
                    if(!reg.test(url)){
                        tips=0;
                        return false;
                    }
                }
                if(input.hasClass("required") && input.val() == "")
                {
                    tip += input.attr("placeholder") + " ,";
                }
            });
            if(tips==0){
                alert('链接处必须填写url地址');
                return false;
            }
            if(tip !== "")
            {
                alert(tip+" 必须输入!");
                return false;
            }
            $.post(form.action, data,function(result){
                result =  eval("("+result+")");
                alert(result.message);
                if( result.forwardUrl !== 'null' && result.forwardUrl !== null )
                {
                    window.location.href = result.forwardUrl;
                }
            });
            return false;
        }
    </script>
</head>

<body>

<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="<?php echo url("leftmenu/bottom")?>">首页</a></li>
        <?php if(isset($links)):?>
            <?php foreach($links as $k=>$v): ?>
                <li><a href="<?php echo $v['url']?>"><?php echo $v['title']?></a></li>
            <?php endforeach;?>
        <?php endif;?>
    </ul>
</div>

<div class="formbody">


    <div id="usual1" class="usual">

        <div id="tab1" class="tabson">


            <ul class="forminfo">
                <form
                    <?php foreach ($form->attrs() as $attr => $value): $value = h($value); echo "{$attr}=\"{$value}\" "; endforeach; ?>>
                    <?php foreach ($form->elements() as $element){?>
                        <?php if($element->id == '_js')
                        {
                            $_js = $element->value;
                            continue;
                        }
                        ?>
                        <li>
                            <?php if($element->_label=='模块跳转链接'){?>
                                <label id='moduleto' ><?php echo $element->_label?> </label>
                            <?php }else if($element->_label=='奖励数量'){?>
                                <label id='lottery_data_label' ><?php echo $element->_label?> </label>
                            <?php }else if($element->_label=='奖品名称'){?>
                                <label id='lottery_title_label' ><?php echo $element->_label?> </label>
                            <?php }else{?>
                                <label  ><?php echo $element->_label?> </label>
                            <?php }?>
                            <?php

                            $data = $element->attrs();
                            if($element->title)
                            {
                                //title有配置信息时，优先
                                $data['title'] = $element->title;
                            }else{
                                //select 组件不提示（避免JS事件冲突）
                                if( $element->_label && strpos($element->class, 'select') === FALSE)
                                {
                                    $data['title'] = $element->_label;
                                }
                            }
                            if($element->_ui == 'textbox' || $element->_ui == 'dfinput')
                            {
                                @$data['class'] .= " dfinput";
                            }
                            if($element->_ui == 'dropdownlist')
                            {

                            }
                            if($element->_ui == 'bdeditor')
                            {
                                echo '<br><br>';
                            }

                            if($element->_ui == 'img'){?>
                                <div>
                                    <img   src="<?php echo $_BASE_DIR?>coupon/1.png" id='img' />
                                </div>
                            <?php }else{
                                if($element->id=='probability'){
                                    $sql="select sum(probability) from voip.lottery_custom where voip_agentid = {$_SESSION['acct']['id']}";
                                    $pro=$data=QDB::getConn()->execute($sql)->fetchOne();
                                    $proleft= 100-$pro;
                                    echo Q::control($element->_ui, $element->id, array('class'=>'required dfinput','onkeyup'=>"check_pro()",'title'=>'此处最大值'.$proleft,'placeholder'=>'此处最大值'.$proleft,'value'=>$element->value));
                                }else{
                                    if(!isset($data['placeholder'])) $data['placeholder'] = 	$element->_label;
                                    echo Q::control($element->_ui, $element->id, $data);
                                }
                            }?>

                        </li>
                    <?php }?>

                    <li><label>&nbsp;</label><input name="" type="submit" class="btn" value="提交"/>&nbsp;&nbsp; </li>

                </form>
            </ul>
        </div>
    </div>
</div>
<?php if(!empty($_js)) echo $_js;?>
</body>
</html>